<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
        <title>账户明细</title>
        <link rel="stylesheet" href="<c:url value="/static/wx/css/style.css"/>" />
        <script type="text/javascript" src="<c:url value="/static/wx/js/lib/rem.js"/>"></script>
	</head>
    <body class="befeff4">
        <div id="wrap">
            <div class='balanceDetail_wrap' id="tr_list">
            </div>
        </div>
    </body>
    
    <input type="hidden" id="userId" value="${userId}"/>
    <script type="text/javascript" src="<c:url value="/static/wx/js/lib/jquery-3.3.1.min.js"/>"></script>
    <script type="text/javascript">
	    var userId = $("#userId").val();
	    $(document).ready(function(){
	    	accountList();
	    });
	    
	    function accountList(){
	        $.ajax({
	            type: "post",
	            url: "<c:url value="/wx/toAccountList.do"/>",
	            data:{
	                userId : userId,
	                page : 1,
	                size : 10,
	            },
	            cache: true,
	            async:false, 
	            dataType: "json",
	            success: function(data){
	                 var result = "";
	                 if (data.pages.result.length>0) {
	                	 for (var i = 0 ; i<data.pages.result.length;i++) {
	                		 result += "<div class='section-list'>";
	                		 result += "<div class='common boder-bottom'>";
	                		 result += "<div class='top_text clearfix'>";
	                		 result += "<span class='fl'>";
	                		 //回收员类型 1 充值 2 提现 3 支出 4 收入
	                		 if (data.pages.result[i].businessType == 1) {
	                			 result += "充值";
	                			 result += "</span>";
	                             result += "<span class='cff6633 fr'>+ "+data.pages.result[i].price+" 元</span>";
	                		 }else if (data.pages.result[i].businessType == 2) {
	                			 result += "提现";
	                			 result += "</span>";
	                             result += "<span class='c41afa5 fr'>- "+data.pages.result[i].price+" 元</span>";
                             }else if (data.pages.result[i].businessType == 3) {
                            	 result += "支出";
                            	 result += "</span>";
                            	 result += "<span class='c41afa5 fr'>- "+data.pages.result[i].price+" 元</span>";
                             }else if (data.pages.result[i].businessType == 4) {
                            	 result += "收入";
                            	 result += "</span>";
                                 result += "<span class='cff6633 fr'>+ "+data.pages.result[i].price+" 元</span>";
                             }
	                		 
                             result += "</div>";
                             result += "<div class='bottom_text clearfix'>";
                             result += "<span class='fl'>"+data.pages.result[i].createTime.substring(0, 16)+"</span>";
                             if (data.pages.result[i].countAmount != null) {
                            	 
                             result += "<span class='fr'>余额 "+data.pages.result[i].countAmount+" 元</span>";
                             }
                             result += "</div>";
                             result += "</div>";
                             result += "</div>";
	                     } 
	                	 $("#tr_list").html(result);
	                 }else {
	                	 result += "";
	                	 result += " <div class='order_noData tc'>"
                         result += "<img style='margin: 50px auto 10px;width:120px;height:120px'  src=\"<c:url value="/static/wx/img/no_data.png"/>\" />";
                         result += "<p>暂无记录</p>";
                         result += "</div>";
         			   
	                	 $("#tr_list").html(result);
	                 }
	            }
	        })
	    }
    
    </script>
</html>